from aiogram import Bot, types
from aiogram.types import FSInputFile

from src.bot.services.tg_helpers import send_mediafile, send_tg_message
from src.bot.worker.exception_handler import exception_handler


@exception_handler
async def notify_user(
    ctx,
    user_tg_id: int,
    text: str,
    reply_markup: types.ReplyKeyboardMarkup | types.InlineKeyboardMarkup | None = None,
    file: FSInputFile | None = None,
) -> None:
    """Отложенная отправка сообщения пользователю"""

    bot: Bot = ctx["bot"]

    if file:
        await send_mediafile(bot, user_tg_id, file, text, reply_markup=reply_markup)
    else:
        await send_tg_message(bot, user_tg_id, text, reply_markup=reply_markup)
